<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" dir="ltr" lang="it-IT">
<head profile="http://gmpg.org/xfn/11">
	<title>SocialSearch Test</title>
	<meta http-equiv="content-type" content="text/html; charset=UTF-8" />
	<link rel="stylesheet" type="text/css" href="css/style.css" />
</head>
<body class="home">

<div id="wrapper">	
	<div>
		
		<div id="header">
			&nbsp;
		</div> <!-- /header -->
		
		
		<div class="clear"> </div>
	
		<div id="main">
	
			<div>
				<h1 id="logo"><a href="#">SocialSearch</a></h1>
			</div>
			
			<div class="clear"> </div>
			
			<div id="content">
				
			
			</div> <!-- /content -->
			
			<div id="footer">
				<p>SocialSearch &copy; 2009</p>
			</div> <!-- /footer -->

		</div> <!-- /main -->
	
	</div>
		
</div> <!-- /wrapper -->
	

<!-- jQuery -->
<script type="text/javascript" src='http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js'></script>

<script type="text/javascript">

var phpController = "php/ss_controller.php";

$(function(){
	
	// ----------- richieste ajax di prova -----------
	
	// Delicious
	$.post(phpController, {'source' : 'flickr', 'key' : 'joomla'}, function(data) {

		// individuiamo gli elementi
		var xmlElements = $(data).find("element");
		
		var htmlOutput = "<div class='result'><h3>Flickr (chiave:joomla)</h3><ul>";
		
		// cicliamo sui primi 3 elementi utilizzando l'helper di jQuery
		var $i = 0;
		xmlElements.each( function() {
			htmlOutput += "<li><img src='" + $(this).find("thumbnail").text() + "'/></li>";
			if(++$i >= 3) return false;			
		});
		
		htmlOutput += "</ul></div>";
		
		// pubblichiamo l'output
		$("#content").append(htmlOutput);
	});
	

	// Delicious in un'altra forma
	$.post(phpController, {'source' : 'flickr', 'key' : 'cms'}, function(data) {

		// individuiamo gli elementi
		var xmlElements = $(data).find("element");
		
		var htmlOutput = "<div class='result'><h3>Flickr impastato diversamente (chiave:cms)</h3>";
		
		// cicliamo sui primi 5 elementi utilizzando l'helper di jQuery
		$i = 0;
		xmlElements.each( function() {
			htmlOutput += "<span class='flickr-element'><img src='" + $(this).find("thumbnail").text() + "'/></span>";
			if(++$i >= 5) return false;
		});
		
		htmlOutput += "</div>";
		
		// pubblichiamo l'output
		$("#content").append(htmlOutput);
	});	
	
});

</script>
<!-- /jQuery -->
	
</body>
</html>